Page({
  /**
   * 页面的初始数据
   */
  data: {
    status: '全部',
    tabList: [{
        name: '全部'
      },
      {
        name: '国家级'
      },
      {
        name: '江苏省'
      },
      {
        name: '苏州市'
      }
    ],
    markers: [],
    list: [],
    selectOne: '',
    selectOneIndex: '',
    pageNum: 1,
    showList: true,
    onlyView: false,
    userId: ''
  },

  selectTab(e) {
    console.log(e.detail, 'name')
    this.setData({
      status: e.detail.title
    })
    this.setData({
      pageNum: 1,
      list: [],
      markers: [],
      selectOne: '',
      selectOneIndex: ''
    })
    // 重新初始化点
    this.getList()
  },
  async goDetail(e) {
    console.log(e, 'eee')
    const vipCode = await getApp().globalData.checkVipStatus()
    if (vipCode === 'ordinary' || vipCode === 'notVipBindFI' || vipCode === 'visitor') {
      wx.showModal({
        title: '提示',
        content: '该功能为VIP会员功能，请联系客服了解详情。',
        showCancel: false,
        confirmText: '确定',
        success: function () {}
      })
      return
    }
    wx.navigateTo({
      url: `../../sub_teseqiye/page2/page2?featureName=${e.currentTarget.dataset.id}&level=${this.data.status}`,
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onShow() {},

  async getList() {
    const params = {
      level: this.data.status === '全部' ? '' : this.data.status
    }
    console.log({
      ...params
    }, 'params');
    const res = await getApp().globalData.request(
      // "/feature/queryFeatureListByLevel",
      "/feature/queryFeatureListByLevelV3", {
        ...params
      },
      "POST"
    );
    console.log(res, '/feature/queryFeatureListByLevelV3')
    if (res.data.length > 0) {
      this.setData({
        list: res.data
      })
    }
  },

  onLoad(options) {
    this.getList()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    this.getList()
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {},
});